import style from "@/style/component/common/custCardHeader.module.scss"
import React, { useState } from "react";
const CustCardHeader = ({ hideTitle = false, btn = ["年", "月"], titleCenter = false, hideDateBtn = true, hideDownBtn = true, hideBtn = false, title = "模块标题" }) => {
    const [current, setCurrent] = useState(0);
    return (
        <>
            <div className={style.cardHeader}>
                \
                <span className={style.header_title} style={{ textAlign: titleCenter ? "center" : null }}>
                    <span className={style.header_title_word}>{hideTitle ? null : title}</span>
                </span>
                <span className={style.header_more}>
                    {
                        hideBtn ? null : (
                            <span className={style.header_title_Btn}>
                                {
                                    hideDateBtn ? null : (
                                        <>
                                            {
                                                btn.map((item, index) => {
                                                    return (
                                                        <span key={index} onClick={() => setCurrent(index)} className={current === index ? (style.btnActive) : (style.switchBtn)}>{item}</span>
                                                        // <span onClick={() => setCurrent(2)} className={current === 2 ? (style.btnActive) : (style.switchBtn)}>月</span>
                                                    )
                                                })
                                            }
                                        </>
                                    )
                                }
                                {
                                    hideDownBtn ? null : <span className={style.downBtn}>下载</span>
                                }
                            </span>
                        )
                    }
                </span>
            </div>
        </>
    )
}
export default CustCardHeader;